#ifndef INTERNETSERVER_H
#define INTERNETSERVER_H

#include <QObject>
#include <QAbstractSocket>
#include <QTcpSocket>
#include <QTcpServer>
#include <database.h>
#include <sqldatabase.h>
#include <QDateTime>
#include <mainwindow.h>
class InternetServer: public QObject
{
    Q_OBJECT
public:
    InternetServer();
    ~InternetServer();
    InternetServer(const QHostAddress &address, quint16 port);
    bool S_listen(const QHostAddress &address, quint16 port);
    void S_connect();
    void setMainWindow(MainWindow * pMainWindow);

private:
    QTcpServer server;
    QByteArray buffer;
    database d;
    QTcpSocket *socket;
    sqliteDatabase sql;
    float temperature;//温度数据
    float humidity;//湿度数据
    float dust_density;//粉尘密度数据
    float MFS;//磁场强度
    MainWindow *pMainWindow;
    QDateTime currentDateTime;
private slots:
    void onReadyRead();
};



#endif // INTERNETSERVER_H
